package org.goodprinciples.commons.factory;

/**
 *
 * @author Francesco Conte
 */
public abstract class SingletonFactory<T> extends FactoryBase<T> {

    private T instance = null;

    @Override
    public final T getInstance() {
        if(instance == null) {
            instance = newInstance();
        }
        return instance;
    }

    protected abstract T newInstance();

}
